home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / ACORNUSERS / EMULATOR / MAGICKIT / assembler / c / stricmp < prev    next >
Text File  |  1998-04-27  |  476b  |  28 lines

  1. #include <string.h>
  2. #include <ctype.h>
  3.  
  4. int
  5. stricmp(const char *s1, const char *s2) {
  6.     int c1, c2;
  7.  
  8.     do {
  9.         c1 = tolower(*(s1++));
  10.         c2 = tolower(*(s2++));
  11.     } while (c1 == c2 && c1 != 0);
  12.  
  13.     return(c1 - c2);
  14. }
  15.  
  16. int
  17. strnicmp(const char *s1, const char *s2, size_t i) {
  18.     int c1, c2;
  19.  
  20.     if (i <= 0) return(0);
  21.     do {
  22.         c1 = tolower(*(s1++));
  23.         c2 = tolower(*(s2++));
  24.     } while (c1 == c2 && c1 != 0 && --i > 0);
  25.  
  26.     return(c1 - c2);
  27. }
  28.